package org.languageguide.media;


public class Config{
	
	MediaGenerator  mediaPlayer;
	boolean offensive;
	String cookieString;
	String cookieStringOld;
	
	public Config(MediaGenerator mediaPlayer, boolean offensive){
		this.mediaPlayer = mediaPlayer;
		this.offensive = offensive;
		cookieString = mediaPlayer.getKey() + getOffensiveString(offensive);
		cookieStringOld = mediaPlayer.getOldKey() + getOffensiveString(offensive);
	}
	
	
	public String getOffensiveString(boolean offensive){
		if (offensive)
			return "1";
		else return "0";
	}
	
	public boolean isMobile(){
		if (mediaPlayer.getOldKey().equals("3")){
			return true;
		}
		else return false;	
	}
	
	public MediaGenerator getMediaGenerator(){
		return mediaPlayer;
	}
	
	public boolean displayOffensive(){
		return offensive;
	}
	
	
	public String getCookieString(){
		return cookieString;
	}
	
	public String getCookieStringOld(){
		return cookieStringOld;
	}
	
	public boolean useSvg(){
		return mediaPlayer.useSvg();
	}
	
	public boolean supportsTouchEvents(){
		if (mediaPlayer.getOldKey().equals("3")){
			return true;
		}
		return false;
	}
	
	public String getPureSoundJS(){
		String key = mediaPlayer.getOldKey();
		if (key.equals("0") || key.equals("4")){
			return "<script src=\"/applets/qtaudio.js\"></script>\n";
		}
		else return "<script src=\"/applets/html5audio.js\"></script>\n";
	}
}
